//
//  TKL_blogCommentCell.m
//  TKL_EnPro
//
//  Created by 雅恩三河科技 on 2018/12/11.
//  Copyright © 2018年 MrZhang. All rights reserved.
//

#import "TKL_blogCommentCell.h"

@interface TKL_blogCommentCell ()
@property(nonatomic,strong)UIImageView* headIV;
@property(nonatomic,strong)UILabel* nameLab;
@property(nonatomic,strong)UILabel* timeLab;
@property(nonatomic,strong)UILabel* countLab;
@end

@implementation TKL_blogCommentCell
-(UIImageView *)headIV
{
    if (!_headIV) {
        _headIV=[[UIImageView alloc] init];
        _headIV.x=WFCGFloatX(10);
        _headIV.backgroundColor=[UIColor redColor];
        _headIV.width=WFCGFloatX(25);
        _headIV.height=_headIV.width;
        _headIV.y=WFCGFloatY(10);
        [WFFunctions WFUIaddbordertoView:_headIV radius:WFCGFloatX(25)/2 width:0 color:[UIColor clearColor]];
    }
    return _headIV;
}
-(UILabel *)nameLab
{
    if (!_nameLab) {
        _nameLab=[[UILabel alloc] init];
        _nameLab.x=WFCGFloatX(40);
        _nameLab.y=WFCGFloatY(10);
        _nameLab.width=WFCGFloatX(200);
        _nameLab.height=WFCGFloatY(15);
        _nameLab.font=SYSTEMFONT(15);
        _nameLab.textColor=HEXCOLOR(@"#333333");
        _nameLab.backgroundColor=[UIColor whiteColor];
        
    }
    return _nameLab;
}
-(UILabel *)timeLab
{
    if (!_timeLab) {
        _timeLab=[[UILabel alloc] init];
        _timeLab.x=WFCGFloatX(40);
        _timeLab.y=WFCGFloatY(30);
        _timeLab.width=WFCGFloatX(200);
        _timeLab.height=WFCGFloatY(10);
        _timeLab.font=SYSTEMFONT(10);
        _timeLab.textColor=HEXCOLOR(@"#999999");
        _timeLab.backgroundColor=[UIColor whiteColor];
        
    }
    return _timeLab;
}
-(UILabel *)countLab
{
    if (!_countLab) {
        _countLab=[[UILabel alloc] init];
        _countLab.x=WFCGFloatX(40);
        _countLab.y=WFCGFloatY(50);
        _countLab.width=SCREEN_WIDTH-WFCGFloatX(55);
        _countLab.height=WFCGFloatY(40);
        _countLab.font=SYSTEMFONT(12);
        _countLab.textColor=HEXCOLOR(@"#666666");
        _countLab.backgroundColor=[UIColor whiteColor];
        _countLab.numberOfLines=0;
    }
    return _countLab;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = Main_Color_White;
        [self.contentView addSubview:self.headIV];
        [self.contentView addSubview:self.nameLab];
        [self.contentView addSubview:self.timeLab];
        [self.contentView addSubview:self.countLab];
    }
    return self;
}
-(void)setModel:(NSMutableDictionary *)model
{
    
    [_headIV sd_setImageWithURL:[NSURL URLWithString:[WFFunctions WFCheckEmptyBackStr:[[model objectForKey:@"owner"] objectForKey:@"avatar"]]] placeholderImage:DefaultAvatarMImage];
    _nameLab.text=[[model objectForKey:@"owner"] objectForKey:@"nickname"];
    _timeLab.text=[WFFunctions getDateWithTimeStamp:[model objectForKey:@"createTime"] formatter:@"yyyy-mm-dd"];
    _countLab.text=[model objectForKey:@"content"];
    CGSize temSize=[WFFunctions WFStrGetSize:_countLab.text width:SCREEN_WIDTH-WFCGFloatX(55) font:SYSTEMFONT(12)];
    if (temSize.height<15)
    {
        _countLab.height=15;
    }else
    {
        _countLab.height=temSize.height;
    }
}
@end
